package org.td.engine.entity;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import org.td.engine.combat.Target;

public abstract class Entity implements Target {
    
    protected float x;
    protected float y;
    protected boolean clear;
    
    protected EntityEnvironment environment;
    protected EntitySprite sprite;
    
    public Entity(EntityEnvironment environment, EntityClass entityClass) {
        this.environment = environment;
        sprite = new EntitySprite(entityClass.getAssetFile());
        clear = false;
    }
    
    public void render(SpriteBatch batch) {
        sprite.render(batch, x, y, true);
    }
    
    public abstract void update(float time);
    public abstract EntityClass getEntityClass();

    public void markClear() {
        this.clear = true;
    }

    public boolean canClear() {
        return clear;
    }
    
    public void setPosition(float x, float y) {
        this.x = x;
        this.y = y;
    }
    
    public float getX() {
        return x;
    }
    
    public float getY() {
        return y;
    }
    
    public EntityEnvironment getEntityEnvironment() {
        return environment;
    }
}
